<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title></title>
	<script>
		//封装自己的sort方法(数组)
		var arr1=[20,3,16,4,];
		function mysort(arr1){
			for(var i=0;i<arr1.length;i++){
				for(var k=i+1;k<arr1.length;k++){
					if(arr1[i]<arr1[k])
						var r=arr1[k];
				        arr1[k]=arr1[i];
				        arr1[i]=r;
				}
			}
			console.log(arr1);
		}
		mysort(arr1);
	</script>
</head>
<body>
	
</body>
</html>